<%@ page import="com.qianfeng.pojo.Friender" %>
<%@ page import="com.sun.org.apache.bcel.internal.generic.GOTO" %>
<%@ page import="com.qianfeng.pojo.Address" %><%--
  Created by IntelliJ IDEA.
  User: jackiechan
  Date: 2021/9/1
  Time: 09:37
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%

    Friender friender = new Friender();
    friender.setGender("女");
    friender.setAge(70);
    friender.setName("专业找小哥哥50年");
    friender.setDescription("肤白貌美");
    request.setAttribute("girl", friender);
    Address address = new Address();
    address.setAddress("园墅别墅区");
    friender.setAddress(address);
%>

<h1>原始方式</h1>

<%
    Friender girl = (Friender) request.getAttribute("girl");
    out.print(girl.getName());
    out.print("<br>");
    out.print(girl.getAge());
    out.print("<br>");
    out.print(girl.getGender());
    out.print("<br>");
    out.print(girl.getD());
%>
<h3>----------------------华丽的分割线----------------------------</h3>

<h1>EL表达式的方式</h1>
<%--

通过 girl 可以找到 friender 对象,然后通过.name 找 name 属性的值
--%>
${girl.name}<br>
${girl.age}<br>
${girl.gender}<br>
<%--
这里写的都是属性的名字,不是变量的名字,虽然大部分情况下我们通过开发工具生成的属性和变量名保持了一致,但是也有可能不一致
--%>
${girl.d}<br>
${girl.address.address}<br>

</body>
</html>
